<!-- 添加文档区域 (隐藏) -->
<div id="add-document-section" class="tab-panel">
    <div class="add-document-container">
        <div class="add-document-header">
            <button class="back-btn" onclick="backToDocsList()">
                <i class="bi bi-arrow-left"></i>
                <span>返回文档列表</span>
            </button>
            <h2 id="add-document-title">添加文档</h2>
        </div>
        
        <div class="add-document-form">
            <div class="form-content">
                <div class="form-group">
                    <label for="doc-title">
                        <i class="bi bi-type-h1"></i>
                        文档标题
                    </label>
                    <input type="text" id="doc-title" placeholder="请输入文档标题" maxlength="100">
                </div>
                
                <div class="method-tabs">
                    <div class="method-tab active" data-method="text" onclick="switchInputMethod('text')">
                        <i class="bi bi-textarea-t"></i>
                        <span>文本输入</span>
                    </div>
                    <div class="method-tab" data-method="file" onclick="switchInputMethod('file')">
                        <i class="bi bi-file-earmark-arrow-up"></i>
                        <span>文件上传</span>
                    </div>
                </div>
                
                <div id="text-input-method" class="input-method-content">
                    <div class="form-group">
                        <label for="kb-content">
                            <i class="bi bi-markdown"></i>
                            文档内容 (支持Markdown格式)
                        </label>
                        <textarea id="kb-content" placeholder="请输入文档内容，支持Markdown格式"></textarea>
                    </div>
                    
                    <div id="markdown-preview" class="markdown-preview" style="display: none;">
                        <div class="preview-header">
                            <h3>Markdown预览</h3>
                            <button class="close-preview-btn" onclick="togglePreview()">
                                <i class="bi bi-x"></i>
                            </button>
                        </div>
                        <div class="preview-content"></div>
                    </div>
                </div>
                
                <div id="file-input-method" class="input-method-content" style="display: none;">
                    <div class="file-upload-area">
                        <label for="file-upload" class="file-upload-label">
                            <i class="bi bi-cloud-upload"></i>
                            <span>点击上传文件或拖拽文件到此处</span>
                            <span class="file-types-hint">支持PDF、Word、Excel、TXT等格式</span>
                            <a href="javascript:void(0);" onclick="showSupportedFileTypes()">查看支持的文件类型</a>
                        </label>
                        <input type="file" id="file-upload">
                    </div>
                    
                    <div id="file-info" class="file-info" style="display: none;">
                        <div class="file-info-header">
                            <div class="file-details">
                                <div id="file-name" class="file-name">document.pdf</div>
                                <div id="file-size" class="file-size">1.2MB</div>
                            </div>
                            <button class="remove-file-btn" onclick="removeSelectedFile()">
                                <i class="bi bi-x"></i>
                            </button>
                        </div>
                        
                        <div id="file-preview-container" class="file-preview-container" style="display: none;">
                            <div class="file-preview-header">
                                <h4>文件内容预览</h4>
                            </div>
                            <div id="file-content-preview" class="file-content-preview"></div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="form-actions">
                <button type="button" class="preview-btn" onclick="togglePreview()" id="text-preview-btn">
                    <i class="bi bi-eye"></i>
                    <span>预览</span>
                </button>
                <button class="secondary-btn" onclick="backToDocsList()">
                    <i class="bi bi-x-circle"></i> 取消
                </button>
                <button id="add-document-btn" class="primary-btn">
                    <i class="bi bi-plus-circle"></i> 添加到知识库
                </button>
            </div>
        </div>
    </div>
</div> 